import sqlite3
from sqlite3 import Error


def create_connection(db_file):
    """ 创建数据库连接 """
    conn = None
    try:
        conn = sqlite3.connect(db_file)
        return conn
    except Error as e:
        print(e)

    return conn


def create_tables(conn):
    """ 创建数据库表结构 """
    try:
        c = conn.cursor()

        # 创建客户信息表
        c.execute('''
        
                  ''')

        # 创建账户表
        c.execute('''
                  ''')

        # 创建交易记录表
        c.execute('''''')

        conn.commit()
        print("数据库表创建成功")
    except Error as e:
        print(e)


def initialize_database():
    """ 初始化数据库 """
    database = "bank_system.db"

    # 创建数据库连接
    conn = create_connection(database)

    if conn is not None:
        # 创建表
        create_tables(conn)
        conn.close()
    else:
        print("无法创建数据库连接"